﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObjects.BO_GetObjects;
using System.Data;


public partial class Controls_Products : Base_Controls
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PSize = 5;
        Session["lang"] = "en-US";
        //Session["lang"] = null;
        if(!IsPostBack)
        {
            this.Display();
        }
    }
    protected void Display()
    {
        if (base.Lang)
        {
            DataTable dtProduct = BO_portal_categories.SelectByParentWithPaged(80, base.Cur_page, base.PSize, 1);
            foreach (DataRow row in dtProduct.Rows)
            {

                row["FULL_CATEGORY_NAME"] = row["FULL_CATEGORY_NAME_ENG"].ToString();
            }
            bindRepeater(rptProductContent, dtProduct, pagerContainer);    

        }
        else
        {
            bindRepeater(rptProductContent, BO_portal_categories.SelectByParentWithPaged(80, base.Cur_page, base.PSize, 1), pagerContainer);
        }
        
       

    }
    protected DataTable ShowProducts(int category_id)
    {
        try
        {
            DataTable objDTs = BO_portal_articles.SelectByCategory(1, 8, category_id, "-----");
            if(base.Lang)
            {
                foreach (DataRow row in objDTs.Rows)
                {
                    row["FULL_ARTICLE_TITLE"] = row["FULL_ARTICLE_TITLE_ENG"].ToString();
                }
            }
            
            return objDTs;
        }
        catch
        {
            return null;
        }
    }
}